<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>表格内的定位</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="author" content="yb">
    <meta name="keywords" content="关键词" />
    <meta name="description" content="描述" />
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="Expires" content="0">
    <!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> -->
    <script src="https://cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
    <link rel="stylesheet" href="../style/css/base.css">
    <style>
        #tableDiv {
            width: 1300px;
            overflow-x: auto;
            overflow-y: auto;
            margin: 0 auto auto 20px;
            background-color: #ffe4c4;
            position: relative;
        }
        .tableHead {
            width: 1326px;
            background-color: #ffe4c4;
            position: relative;
        }

        .tableBody {
            width: 1326px;
            height: 150px;
            overflow-y: auto;
            background-color: #ffe4c4;
            position: relative;
            font-size: 0;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
        }

        tr {
            height: 40px;
            position: relative;
            font-size: 16px;
        }

        td {
            width: 100px;
            height: 40px;
            padding: 2px 5px;
            border: 1px solid #aaa;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="tableDiv">
        <div class="tableHead">
            <div style="width:336px;display: inline-block;">
                <table>
                    <thead>
                        <tr>
                            <td>项目名称</td>
                            <td>项目号</td>
                            <td>人员名称</td>
                        </tr>
                    </thead>
                </table>
            </div>
            <div style="width:404px;display: inline-block;overflow:hidden;background: blue;color: #fff;position: relative;height: 46px;">
                <div id="scroll1"  style="width:896px;display: inline-block;position: absolute;left: 0;top: 0;">
                    <table>
                        <thead>
                            <tr>
                                <td>a</td>
                                <td>b</td>
                                <td>c</td>
                                <td>1</td>
                                <td>2</td>
                                <td>3</td>
                                <td>4</td>
                                <td>5</td>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div style="width:560px;display: inline-block;">
                <table>
                    <thead>
                        <tr>
                            <td>6</td>
                            <td>7</td>
                            <td>8</td>
                            <td></td>
                            <td>项目状态</td>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="tableBody">
            <div style="width:336px;display: inline-block;">
                <table>
                    <tbody>
                        <tr>
                            <td>ali1</td>
                            <td>9377</td>
                            <td>王小二</td>
                        </tr>
                        <tr>
                            <td>ali1</td>
                            <td>9377</td>
                            <td>王小二</td>
                        </tr>
                        <tr>
                            <td>ali1</td>
                            <td>9377</td>
                            <td>王小二</td>
                        </tr>
                        <tr>
                            <td>ali1</td>
                            <td>9377</td>
                            <td>王小二</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div id="scroll2" style="width:404px;display: inline-block;overflow:auto;background: blue;color: #fff;">
                <div style="width:896px;display: inline-block;">
                    <table>
                        <tbody>
                            <tr>
                                <td>2</td>
                                <td>2</td>
                                <td>3</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>2</td>
                                <td>3</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>2</td>
                                <td>3</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>2</td>
                                <td>3</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                                <td>1</td>
                            </tr>

                        </tbody>
                    </table>
                </div>
            </div>
            <div style="width:560px;display: inline-block;">
                <table>
                    <tbody>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>已完成</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>已完成</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>已完成</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>1</td>
                            <td>已完成</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</body>
<script>
  $(function(){
      $('#scroll2').scroll(function(e){
          $('#scroll1').css('left',-$(this).scrollLeft());
      })
  })
</script>
</html>